package org.summer.lawyer.constant.enums;

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 支付方式
 */
@Getter
@AllArgsConstructor
public enum PaymentMethod {


    /**
     * 微信小程序
     */
    WECHAT_MINIAPP("WeChat_MiniApp", "微信小程序"),

    /**
     * 支付宝
     */
    ALIPAY("Alipay", "支付宝"),


    /**
     * 信用卡
     */
    CREDITCARD("CreditCard", "信用卡"),

    /**
     * 借记卡
     */
    DEBITCARD("DebitCard", "借记卡"),

    /**
     * 银行转帐
     */
    BANKTRANSFER("BankTransfer", "银行转帐");

    public static PaymentMethod getByCode(String code) {
        return ArrayUtil.firstMatch(item -> item.getCode().equals(code), values());
    }

    private final String code;
    private final String info;
}
